;;; init-projectile.el --- Use Projectile for navigation within projects -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(when (maybe-require-package 'projectile)
  (add-hook 'after-init-hook 'projectile-mode)

  ;; Shorter modeline
  (setq-default projectile-mode-line-prefix " Proj")

  (when (executable-find "rg")
    (setq-default projectile-generic-command "rg --files --hidden"))

  (with-eval-after-load 'projectile
    (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
    (defun my/project-goto-file-at-point (&optional filename invalidate-cache)
      (interactive (list (when-let ((s (symbol-at-point)))
                           (nth 0 (last
                                   (split-string (symbol-name s) "/" ))))))
      (if (fboundp 'xref-push-marker-stack)
          (xref-push-marker-stack)
        (with-no-warnings
          (ring-insert find-tag-marker-ring (point-marker))))
      (set-register ?x filename)
      (projectile--find-file invalidate-cache))
    (global-set-key [remap projectile-find-file] 'my/project-goto-file-at-point)
    (global-set-key (kbd "M-.") 'my/project-goto-file-at-point)
    )

  (maybe-require-package 'ibuffer-projectile)

  ;; common.css  checkCount.js checkCount.js


  )

(defun my/inter (str1 str2)
  (interactive (list (symbol-name (symbol-at-point)) "123"))
  (message "input %S %s" str1 str2))

;; oinit.el


(provide 'init-projectile)
;;; init-projectile.el ends here
